package Day28;

public class Demo02 {
    public static void main(String[] args) throws ClassNotFoundException {
        //第一种   通过包名.类名.class 加载类
        //Class<Person> c1 = Person.class;
        Class<Person> c1 = Day28.Person.class;
        System.out.println(c1);//class Day28.Person

        //第二种，通过类的对象获取类的信息
        Person p = new Person();
        Class<Person> c2 = (Class<Person>) p.getClass();
        System.out.println(c2);//class Day28.Person

        System.out.println(c1 == c2);//true

        //第三种
        //Class<Person> c3 = (Class<Person>) Class.forName("Day28.Person");
        Class c3 = Class.forName("Day28.Person");
        System.out.println(c3);//class Day28.Person

        System.out.println(c1 == c2 && c1 == c3);//true
    }
}
